<!DOCTYPE html>
<html>
<meta charset="utf-8">
<head th:include="include :: header"></head>
<body class="gray-bg">
<div class="wrapper wrapper-content ">
    <div class="row">
        <div class="col-sm-12">
            <div class="ibox float-e-margins">
                <div class="ibox-content">
                    <form class="form-horizontal m-t" id="signupForm">
                        <div class="form-group">
                            <label class="col-sm-3 control-label">广告联盟名称：</label>
                            <div class="col-sm-8">
                                <select id="advunionid" name="advunionid" class="form-control" type="text"></select>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-3 control-label">账号：</label>
                            <div class="col-sm-8">
                                <input maxlength="30" id="unionaccount" name="unionaccount" class="form-control" type="text">
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-3 control-label">密码明文：</label>
                            <div class="col-sm-8">
                                <input maxlength="30" id="unionpassword" name="unionpassword" class="form-control" type="text">
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-3 control-label">描述：</label>
                            <div class="col-sm-8">
                                <input maxlength="50" id="accountdes" name="accountdes" class="form-control" type="text">
                            </div>
                        </div>
                        <!--<div class="form-group">
                            <button type="button" class="btn  btn-primary" onclick="addApp()">
                                <i class="fa fa-apple" aria-hidden="true"></i>添加应用
                            </button>
                        </div>
                        <div class="form-group">
                            <table id="taskclient"
                                   style="border: 1px solid #ccc;border-collapse:collapse;width: 100%;height: auto">
                                <tr>
                                    <th>应用名称</th>
                                    <th>应用ID</th>
                                    <th>操作</th>
                                </tr>
                            </table>
                        </div>-->
                        <div class="form-group">
                            <div class="col-sm-8 col-sm-offset-3">
                                <button type="submit" class="btn btn-primary">提交</button>
                            </div>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>
</div>
<div th:include="include::footer"></div>
<script type="text/javascript" src="/js/appjs/market/platformAdvunionAccount/add.js">
</script>
<script type="text/javascript" th:inline="javascript">
    $(function () {
        $.ajax({
            type: 'get',
            url: '/market/platformAdvunionAccount/listAllAdvUnion',
            dataType: 'json',
            success: function (datas) {
                //返回list数据并循环获取
                var select = $("#advunionid");
                for (var i = 0; i < datas.length; i++) {
                    select.append("<option value='" + datas[i].id + "'>"
                        + datas[i].advUnionName + "</option>");
                }
            }
        });
    })
    var index = 0;

    function addApp() {
        var row = $("<tr></tr>");
        var thirdSdklist = [[${thirdSdklist}]];
        var html = "<select name='taskspiderrelatList[" + index + "].thirdSdkId" + "' id='" + "thirdSdkId" + index + "'>";
        for (var i in thirdSdklist) {
            html += "<option value='" + thirdSdklist[i].thirdSdkId + "'>" + thirdSdklist[i].thirdName + "</option>";
        }
        var newCell3 = $("<td  align='center'></td>").append($(html));
        var newCell4 = $("<td><input type=\"text\"   name=\"taskspiderrelatList[" + index + "].unionAppId\" id=\"unionAppId" + index + "\" ></td>");
        var newCell5 = $("<td></td>").append($("<a href=\"javascript:void(0);\" onclick=\"dele('" + index + "')\" title=\"删除\">" + "删除" + "</a>"));
        row.append(newCell3).append(newCell4).append(newCell5);
        $("#taskclient").append(row);
        index += 1;
    }

    function dele(index) {
        $("#unionAppId" + index).parent().parent().remove();
    }
</script>
</body>
</html>
